﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using YachtCaptain.Game_States;

namespace YachtCaptain.Game_States
{
    class CMainMenuState : IBaseState
    {
        //FOR SINGLETON
        private static CMainMenuState instance;
        Game Game1OBJ;

        //TEXTURES
        List<Texture2D> m_LMainMenuTextures;

        //MOUSE INPUT
        MouseState m_MouseCurrState;

        private CMainMenuState() { }

        public static CMainMenuState GetInstance()
        {
            if (instance == null)
            {
                instance = new CMainMenuState();
            }
            return instance;
        }

        public override void LoadContent()
        {
            m_LMainMenuTextures = Game1OBJ.LoadMainMenuContent();
        }

        public override void Initialize(Game obj)
        {
            Game1OBJ = obj;
            LoadContent();
        }

        public override void Update()
        {

        }

        public override void Render(SpriteBatch spriteB)
        {
            Vector2 pos = new Vector2(0.0f, 0.0f);
            spriteB.Draw(m_LMainMenuTextures[0], pos, Color.White);
        }

        public override void Input()
        {
            m_MouseCurrState = Mouse.GetState();

            //IF YOU CLICK ON THE START BUTTON
            if (m_MouseCurrState.LeftButton == ButtonState.Pressed)
            {
                if ((m_MouseCurrState.X >= 310 && m_MouseCurrState.X <= 450) &&
                    (m_MouseCurrState.Y >= 255 && m_MouseCurrState.Y <= 300))
                {
                    Game1OBJ.ChangeState(CGameplayState.GetInstance());
                }
            }
        }

        public override void Shutdown()
        {

        }
    }
}
